package com.cluster.platform.controller;

import com.cluster.platform.common.api.CommonResult;
import com.cluster.platform.dto.CmsContentProfileDto;
import com.cluster.platform.model.CmsContentProfile;
import com.cluster.platform.service.CmsContentProfileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName: CmsContentProfileController
 */
@Controller
@Api(tags = "文章概要内容接口", value = "CmsContentProfileController")
@RequestMapping("/cmsContentProfile")
public class CmsContentProfileController {

    @Autowired
    private CmsContentProfileService cmsContentProfileService;

    // 分页查询
    @ApiOperation("文章概要分页查询")
    @RequestMapping(value = "/searchContentProfile", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult<Object> searchContentProfile(@RequestBody CmsContentProfileDto cmsContentProfileDto) {
        return cmsContentProfileService.searchContentProfilePage(cmsContentProfileDto);
    }

    // 新增
    @ApiOperation("新增文章概要")
    @RequestMapping(value = "/addContentProfile", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult<Object> addContentProfile(@RequestBody CmsContentProfile cmsContentProfile) {
        return cmsContentProfileService.addContentProfile(cmsContentProfile);
    }

    // 修改
    @ApiOperation("修改文章概要")
    @RequestMapping(value = "/updateContentProfile", method = RequestMethod.PUT)
    @ResponseBody
    public CommonResult<Object> updateContentProfile(@RequestBody CmsContentProfile cmsContentProfile) {
        return cmsContentProfileService.updateContentProfile(cmsContentProfile);
    }

    // 删除
    @ApiOperation("删除文章概要")
    @RequestMapping(value = "/delContentProfile", method = RequestMethod.DELETE)
    @ResponseBody
    public CommonResult<Object> delContentProfile(@RequestBody CmsContentProfile cmsContentProfile) {
        return cmsContentProfileService.delContentProfile(cmsContentProfile);
    }

    // 物理删除
    @ApiOperation("删除文章")
    @RequestMapping(value = "/delContentProfileByPhysical", method = RequestMethod.DELETE)
    @ResponseBody
    public CommonResult<Object> delContentProfileByPhysical(@RequestBody CmsContentProfile cmsContentProfile) {
        return cmsContentProfileService.deleteContentProfile(cmsContentProfile);
    }

    // 批量操作
    @ApiOperation("批量操作")
    @RequestMapping(value = "/batchContentProfile", method = RequestMethod.PUT)
    @ResponseBody
    public CommonResult<Object> batchContentProfile(@RequestParam("status") Integer status, @RequestParam("ids") List<String> ids) {
        return cmsContentProfileService.batchContentProfile(status, ids);
    }

}
